<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.min.css" rel="stylesheet" />
		<script src="js/jquery-3.1.1.min.js" charset="utf-8"></script>
		<script src="js/mui.min.js"></script>
		<script type="text/javascript">
			mui.init()
		</script>
		<style type="text/css">
			#titlelist {
				/*避免导航边框和列表背景边框重叠，看起来像两条边框似得；*/
				margin-top: -1px;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<a id="Sequence" class="mui-icon-arrowdown mui-icon mui-pull-right"></a>
			<h1 class="mui-title">章节列表</h1>
		</header>
		<div class="mui-content">
			<ul id="titlelist" class="mui-table-view">
			</ul>
		</div>
	</body>
	<script type="text/javascript">
		mui.plusReady(function() {
			if (plus.navigator.isImmersedStatusbar()) { //判断设备是否支持
				var ImmerseHeight = Math.round(plus.navigator.getStatusbarHeight());
				plus.webview.currentWebview().setStyle({
					top: ImmerseHeight,
					bottom: 0,
					bounce: 'none'
				});
			}

			var self = plus.webview.currentWebview();
			$("#titlelist").empty();
			$("title").html(self.bookpage);
			$("#titlelist").append(self.bookindex);
		});

		mui('#titlelist').on('tap', 'a', function() {
			var homePage = plus.webview.currentWebview().opener();
			mui.fire(homePage, 'openbook', this.href.replace("file://", ""));
			mui.back();
		});

		mui(".mui-bar-nav").on('tap', '#Sequence', function() {
			if ($("#Sequence").hasClass("mui-icon-arrowdown")) {
				document.querySelector("li:last-child").scrollIntoView();
				$("#Sequence").removeClass("mui-icon-arrowdown").addClass("mui-icon-arrowup");
			} else {
				window.scroll(0, 0);
				$("#Sequence").removeClass("mui-icon-arrowup").addClass("mui-icon-arrowdown");
			}
		})
	</script>

</html>